package com.dlry.entity;
// Generated 2016-10-31 13:57:37 by Hibernate Tools 3.6.0.Final

import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.persistence.Cacheable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

/**
 * DbTravelRequest generated by hbm2java
 */
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "entityCache")
@Cacheable(true)
@Entity
@Table(name = "dl_travel_request")
public class DlTravelRequest implements java.io.Serializable {

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	/**
	 * 
	 */
	@Transient
	private static final long serialVersionUID = -8101652021163451542L;
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long id;
	@Column(name = "name")
	private String name;
	@Column(name = "from_time")
	private Date fromTime;
	@Column(name = "to_time")
	private Date toTime;
	@Column(name = "reason")
	private String reason;
	@Column(name = "locale")
	private String locale;
	@Column(name = "vail_code", length = 10)
	private String vailCode;
	@Column(name = "create_date")
	private Timestamp createDate;
	@ManyToOne
	@JoinColumn(name = "user_id")
	private DlLoginuser user;
	@Column(name="flowing")
	private Boolean flowing;
	@Transient
	private final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");

//	// bi-directional many-to-one association to DlWorkflow
//	@OneToMany(mappedBy = "dlTravelRequest",targetEntity=DlWorkflow.class, fetch=FetchType.LAZY, cascade=CascadeType.ALL)
//	private List<DlWorkflow> dlWorkflows;

	public DlTravelRequest() {
	}

	public DlTravelRequest(String name, Date fromTime, Date toTime, String locale) {
		this.name = name;
		this.fromTime = fromTime;
		this.toTime = toTime;
		this.locale = locale;
	}

	public DlTravelRequest(String name, Date fromTime, Date toTime, String reason, String locale, String vailCode) {
		this.name = name;
		this.fromTime = fromTime;
		this.toTime = toTime;
		this.reason = reason;
		this.locale = locale;
		this.vailCode = vailCode;
	}

	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Date getFromTime() {
		return this.fromTime;
	}

	public void setFromTime(Date fromTime) {
		this.fromTime = fromTime;
	}

	public Date getToTime() {
		return this.toTime;
	}

	public void setToTime(Date toTime) {
		this.toTime = toTime;
	}

	public String getReason() {
		return this.reason;
	}

	public void setReason(String reason) {
		this.reason = reason;
	}

	public String getLocale() {
		return this.locale;
	}

	public void setLocale(String locale) {
		this.locale = locale;
	}

	public String getVailCode() {
		return this.vailCode;
	}

	public void setVailCode(String vailCode) {
		this.vailCode = vailCode;
	}

	public String getCreateDateStr() {

		return format.format(createDate);
	}

	public Timestamp getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Timestamp createDate) {
		this.createDate = createDate;
	}

	public DlLoginuser getUser() {
		return user;
	}

	public void setUser(DlLoginuser user) {
		this.user = user;
	}

//	public List<DlWorkflow> getDlWorkflows() {
//		return this.dlWorkflows;
//	}
//
//	public void setDlWorkflows(List<DlWorkflow> dlWorkflows) {
//		this.dlWorkflows = dlWorkflows;
//	}

//	public DlWorkflow addDlWorkflow(DlWorkflow dlWorkflow) {
//		getDlWorkflows().add(dlWorkflow);
//		dlWorkflow.setDlTravelRequest(this);
//
//		return dlWorkflow;
//	}
//
//	public DlWorkflow removeDlWorkflow(DlWorkflow dlWorkflow) {
//		getDlWorkflows().remove(dlWorkflow);
//		dlWorkflow.setDlTravelRequest(null);
//
//		return dlWorkflow;
//	}

	public void setFlowing(Boolean flowing) {
		this.flowing = flowing;
	}

	public Boolean getFlowing() {
		return flowing;
	}
}
